<?php 
  /**
   * Kontrollbase
   *
   * An open source MySQL monitoring and analytics application
   *
   * @package Kontrollbase
   * @author Matt Reid
   * @copyright Copyright (c) 2009 Matt Reid, Kontrollbase LLC
   * @license http://kontrollsoft.com/kontrollbase/userguide/general-LICENSE.php
   * @link http://kontrollbase.com
   */

if (!defined('BASEPATH')) exit('No direct script access allowed');

class Model_edit extends Model
{

  function __construct()
  {
    $this->Model_edit();
  }
  
  function Model_edit()
  {
    parent::Model();
  }

  function edit_hosttemplatebinding(
		     $host_list_id,
		     $template_list_id) {
    
    $host_list_id = $this->db->escape_str($host_list_id);
    $template_list_id = $this->db->escape_str($template_list_id);
    
    $dbr = $this->load->database('write', TRUE);
    $sql0="UPDATE host_list SET template_list_id = '$template_list_id' WHERE id = '$host_list_id' LIMIT 1;";

    $this->db->trans_start();
    qstart();
    $this->db->query($sql0);
    $this->db->trans_complete();
    qend();
    if ($this->db->trans_status() === FALSE) {
      show_error('Transaction failed.');
      $this->db->trans_off();
      return 1;
    } 
    else {
      $this->db->trans_off();
      return 0;
    }
  }
  
}
?>
